package com.joven.shelltest.utils.disruptor;

import cn.hutool.extra.spring.SpringUtil;
import com.joven.shelltest.model.Result;
import com.lmax.disruptor.EventHandler;
import lombok.extern.slf4j.Slf4j;

/**
 * 消费者(秒杀处理器)
 * @Author wzj
 * @Date 2023-08-15 10:45
 **/
@Slf4j
public class SecondKillEventConsumer implements EventHandler<SecondKillEvent> {
//    private SecondKillService secondKillService = (SecondKillService) SpringUtil.getBean("secondKillService");

    @Override
    public void onEvent(SecondKillEvent secondKillEvent, long l, boolean b) throws Exception {
//        Result result = secondKillService.startSecondKillByAop(secondKillEvent.getSecKillId(), secondKillEvent.getUserId());
//        if(result.equals(Result.success(SecondKillStateEnum.SUCCESS))){
//            log.info("用户:{}{}",secondKillEvent.getUserId(),"秒杀成功");
//        }
    }
}
